﻿using UnityEngine;
using System.Collections;

public class ComponentGame : MonoBehaviour {

	public float velDown;
	public float minPos, maxPos, posOutDown;

	private Transform trans;
	private float seg;
	
	protected void StartComponentGame () 
	{
		seg = 0.8f;
		trans = GetComponent<Transform> ();
	}

	protected void UpdateComponentGame () 
	{
		seg -= Time.deltaTime;
		if(seg <= 0)
		{
			trans.Translate (new Vector3 (0, -velDown, 0));
			seg = 0.08f;
		}

		// Verifica se a platform saiu da tela de render e destroi o GameObject
		if(trans.transform.position.y <= posOutDown)
		{
			Destroy(gameObject);
		}
	}
}
